<script setup>
import { onBeforeMount, reactive } from 'vue';
import { makeMockData } from './utils.js';

const state = reactive({
  currentTab: 'basic',
  dataList: [],
  isLoading: false,
  hasLoadedAll: false,
  //
  pageSize: 10,
  pageIndex: 0,
  //
});

const fetchPageData = () => {
  if (state.hasLoadedAll || state.isLoading) return;

  state.pageIndex += 1;
  const { List, Total } = makeMockData();
  console.log('fetchPageData', List, Total);
  state.dataList = state.dataList.concat(List || []);
};

onBeforeMount(() => {
  fetchPageData();
});
</script>

<template>
  <div class="q-pa-md q-gutter-sm">
    <h6>上划加载分页数据</h6>
    <t-repeat>
      test
    </t-repeat>
  </div>
</template>

<style lang="sass" scoped>

</style>
